package com.assistant.util;

import net.coobird.thumbnailator.Thumbnails;
import java.io.File;
import java.io.IOException;
import java.util.UUID;

public class ImageUtil {
    public static void main(String[] args) {
        if (args.length!=4){
            return;
        }
        String imageUrl = args[0];
        int lastIndexOf = imageUrl.lastIndexOf(".");
        String imageType = imageUrl.substring(lastIndexOf);
        Thumbnails.Builder builder = Thumbnails.of(args[0]);
        builder.scale(Double.parseDouble(args[3])).outputQuality(Double.parseDouble(args[4]));
        try {
            builder.toFile(new File(UUID.randomUUID().toString()+imageType));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
